import Vue from 'vue'
import http from './http'


Vue.prototype.$http = {
  //获取普通用户
  async getusers() {
    return http.get('/getusers')
  },
  //获取管理员用户
  async getadminusers() {
    return http.get('/getadminusers')
  },
  //编辑普通用户
  async editusers(id, user) {
    return http.put('/editusers/' + id, user)
  },
  //删除普通用户
  async deleteuser(id) {
    return http.delete('/deleteuser/' + id)
  },
  //普通用户登录
  async login(user) {
    return http.post('/login', user)
  },
  //管理员登录
  async adminlogin(user) {
    return http.post('/adminlogin', user)
  },
  //注册普通账号
  async register(user) {
    return http.post('/register', user)
  },
  //修改密码
  async change(user) {
    return http.post('/change', user)
  },
  //获取服饰
  async shoesandclothes() {
    return http.get('/shoesandclothes')
  },
  //获取全部
  async all() {
    return http.get('/all')
  },
  //获取3c
  async digital() {
    return http.get('/digital')
  },
  //获取books
  async books() {
    return http.get('/books')
  },
  //获取life
  async life() {
    return http.get('/life')
  },
  //获取美妆
  async beauty() {
    return http.get('/beauty')
  },
  //获取其他1
  async others() {
    return http.get('/others')
  },
  //商品详情
  async goodsdetail(col, id) {
    return http.post('/goodsdetail/' + id, col)
  },
  //获取评论
  async getcomments(com, id) {
    return http.post('/getcomments/' + id, com)
  },
  //发表评论
  async comments(com, col, id) {
    return http.put('/comments/' + col + '/' + id, com)
  },
  //收藏商品
  async shoucang(com, user) {
    return http.post('/shoucang/' + user, com)
  },
  //获取我的收藏
  async getshoucang(user) {
    return http.post('/getshoucang/' + user)
  },
  //购买物品
  async shopping(com, user) {
    return http.post('/shopping/' + user, com)
  },
  //商品信息更新
  async sellshopping(com, id) {
    return http.post('/sellshopping/' + id, com)
  },
  //获得订单
  async getshopping(user) {
    return http.post('/getshopping/' + user)
  },
  //获得我的出售
  async getmysell(user) {
    return http.post('/getmysell/' + user)
  },
  //更新商品状态
  async goodsst(id, st) {
    return http.post('/goodsst/' + id, st)
  },
  //上传商品
  async upbaby(com) {
    return http.post('/upbaby', com)
  },
  //搜索商品
  async search(value) {
    return http.get('/search/' + value)
  }

}


//<span>{{this.$store.state.user[0].username}}</span>
